package com.finddreams.module_base.utils;

import android.support.v4.app.Fragment;

import com.alibaba.android.arouter.launcher.ARouter;


/**
 * 作者： andli
 * 时间： 2017/12/18 15:51
 * 描述： 路由的工具类
 */

public class RouteUtils {
    public static final String GoodDetail_Activity_Main     = "/gooddetail/main"; // 商品详情页

    public static final String Home_Fragment_Main           = "/home/main"; // 首页
    public static final String Find_Fragment_Main           = "/find/main"; // 发现
    public static final String User_Fragment_Main           = "/user/main"; // 我的
    public static final String User_Activity_Login          = "/user/login";// 登录

    public static final String ShoppingCart_Fragment_Main   = "/shoppingcart/main"; // 购物车

    public static final String Service_User = "/user/service";

    public static Fragment getFindFragment() {
        Fragment fragment = (Fragment) ARouter.getInstance().build(Find_Fragment_Main).navigation();
        return fragment;
    }

    public static Fragment getUserFragment() {
        Fragment fragment = (Fragment) ARouter.getInstance().build(User_Fragment_Main).navigation();
        return fragment;
    }

    public static Fragment getHomeFragment() {
        Fragment fragment = (Fragment) ARouter.getInstance().build(Home_Fragment_Main).navigation();
        return fragment;
    }

    public static Fragment getShoppingCartFragment() {
        Fragment fragment = (Fragment) ARouter.getInstance().build(ShoppingCart_Fragment_Main).navigation();
        return fragment;
    }

    // 跳转到 商品详情的页面
    public static void startGoodDetailActivity(String goodName) {
        // ARouter简单跳转
        ARouter.getInstance().build(GoodDetail_Activity_Main).withString("goodName", goodName).navigation();
    }

    // 跳转到 登录页面
    public static void startLoginActivity() {
        // ARouter简单跳转
        ARouter.getInstance().build(User_Activity_Login).navigation();
    }
}
